const { override, addLessLoader }=require('customize-cra')
console.log('webpack', '开始构建...');

// 配置cdn
const addCdn = () => config => {
    if (isEnvProduction) {
        // 关闭sourceMap
        config.devtool = false;
        config.externals = {
            'react': 'React',
            'react-dom': 'ReactDOM',
        }
    }
    return config;
};

//修改打包路径
const path = require('path');
const paths = require("react-scripts/config/paths");
console.log('paths', paths);
paths.appBuild = path.join(path.dirname(paths.appBuild), "dist2");
//spaths.appPath = './react';
//config.output.path = path.join(path.dirname(config.output.path), "dist");

module.exports = override(
    addLessLoader({
		strictMath: true,
		noIeCompat: true,
		cssModules:{
			localIdentName: "[path][name]__[local]--[hash:base64:5]", 
			// if you use CSS Modules, and custom `localIdentName`, default is '[local]--[hash:base64:5]'.
		}
	})
)